package rentadomus

class LocalController {

    //    def index() { }
    def scaffold = Local
    def save() {
        def localInstance = new Local(params)
        def placeInstance = new Place(params)
        placeInstance.idPerson = session.person
        localInstance.idPlace = placeInstance
        if (placeInstance.save(flush: true)) {
            if (!localInstance.save(flush: true)) {
                render(view: "create", model: [localInstance: localInstance])
                println "pailas"
                return
            }
        }
        redirect(controller:"uploadImage", action: "main", id: placeInstance.id)
    } 
}
